import { PostRequestCacheModel, PostRequestModel } from '@own-basic-component/request'
import type { QueryType } from '@own-basic-component/config'
import type { PageModel } from '~/base/page-model'
import type { TemplateVo } from '~/entity/project/template-vo'
import type { TemplateMapVo } from '~/entity/project/template-map-vo'

// 接口前缀
const API_PREFIX = '/u/template'

export default {

  /**
   * 获取所有的信息
   * @param query 查询条件
   */
  all: (query: QueryType) => new PostRequestModel<Array<TemplateVo>>(`${API_PREFIX}/all`, query).request(),

  /**
   * 获取所有的信息
   * @param query 查询条件
   */
  page: (query: QueryType) => new PostRequestCacheModel<PageModel<TemplateVo>>(`${API_PREFIX}/page`, query).request(),

  /**
   * map
   * @param query 查询条件
   */
  map: (query: QueryType) => new PostRequestCacheModel<Array<TemplateMapVo>>(`${API_PREFIX}/map`, query).request(),

}
